﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using ScheduleMaker.DB.Domain;
using NHibernate;
using NHibernate.Criterion;

namespace ScheduleMaker.DB
{
    public class ClassHourDAO : AbstractDAO<ClassHour>
    {

        public IList<ClassHour> getClassHoursFromInterval(Hour hour)
        {
            createSession();
            ICriteria criteria = session.CreateCriteria(typeof(ClassHour))
                    .Add(Restrictions.Ge("Begin", hour.Begin))
                    .Add(Restrictions.Le("End", hour.End));
            IList<ClassHour> classHours = criteria.AddOrder(Order.Asc("Begin")).List<ClassHour>();
            closeSession();
            return classHours;
        }

    }
}
